home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2 Examples.sit / Raven 1.2 Examples / Quill / Source / ResourceTable.h < prev    next >
C/C++ Source or Header  |  1997-07-27  |  4KB  |  151 lines

  1. /*
  2.  *  File:       ResourceTable.h
  3.  *  Summary:       THierarchicalTable subclass displaying the resources in a document.
  4.  *  Written by: Jesse Jones
  5.  *
  6.  *  Copyright ゥ 1996-1997 Jesse Jones. 
  7.  *    For conditions of distribution and use, see copyright notice in ZTypes.h  
  8.  *
  9.  *  Change History (most recent first):    
  10.  *
  11.  *         <2>     5/04/97    JDJ        Added mPens.
  12.  *         <1>     1/17/96    JDJ        Created
  13.  */
  14.  
  15. #pragma once
  16.  
  17. #include <ZDragSource.h>
  18. #include <ZDragTarget.h>
  19. #include <ZEditableObject.h>
  20. #include <ZHierarchicalTable.h>
  21.  
  22.  
  23. //-----------------------------------
  24. //    Forward References
  25. //
  26. class CResourceSubNode;
  27. class TGWorld;
  28.  
  29.  
  30. // ===================================================================================
  31. //    class CResourceTable
  32. // ===================================================================================
  33. class CResourceTable : public THierarchicalTable, public MEditableObject<CResourceTable>, public MDragSource, public MDragTarget {    
  34.  
  35.     typedef THierarchicalTable Inherited;
  36.  
  37. //-----------------------------------
  38. //    Initialization/Destruction
  39. //
  40. public:
  41.     virtual             ~CResourceTable();
  42.     
  43.                         CResourceTable(const string& name, TView* superView, const TRect& frame, 
  44.                                        MCommander* super);
  45.                 
  46. //-----------------------------------
  47. //    New API
  48. //
  49. public:
  50.             CResourceSubNode* GetWindows()            {return mWindows;}
  51.  
  52.             CResourceSubNode* GetViews()            {return mViews;}
  53.  
  54.             CResourceSubNode* GetTextTraits()        {return mTextTraits;}
  55.  
  56.             CResourceSubNode* GetPens()                {return mPens;}
  57.  
  58. //-----------------------------------
  59. //    THierarchicalTable API
  60. //
  61. protected:
  62.     virtual void         Invariant() const;
  63.  
  64.     virtual void         OnReanimated();
  65.     
  66.     virtual bool         OnMouseDown(const TMouseEvent& event);
  67.  
  68.     virtual bool         OnContextMenu(const TMouseEvent& event);
  69.  
  70.     virtual bool         OnKeyDown(const TKeyEvent& event);
  71.  
  72.     virtual bool         OnMenuCommand(const MenuCommand& command);
  73.         
  74.     virtual bool         OnCommandStatus(const MenuCommand& command, SCommandStatus& status);
  75.  
  76. //-----------------------------------
  77. //    MEditableObject API
  78. //
  79. public:
  80.     virtual bool         HasSelection() const;
  81.  
  82. protected:
  83.     virtual void         OnCopy(OSType type, TOutStream& stream);
  84.  
  85.     virtual void         OnPaste(OSType type, TInStream& stream);
  86.  
  87.     virtual void         OnClear();
  88.  
  89.     virtual ulong         GetCopyCount() const;
  90.     
  91.     virtual OSType        GetCopyType(ulong index) const;
  92.     
  93.     virtual ulong         GetPasteCount() const;
  94.     
  95.     virtual OSType        GetPasteType(ulong index) const;
  96.         
  97. //-----------------------------------
  98. //    MDragSource API
  99. //
  100. protected:
  101.     virtual void         OnAddDragData(TDragSession& session, const TMouseEvent& event);
  102.                         
  103.     virtual void         OnDragStop(const TMouseEvent& event, bool dragged);
  104.  
  105. //-----------------------------------
  106. //    MDragTarget API
  107. //
  108. protected:
  109.     virtual WindowRef    OnGetDragWindow() const;
  110.  
  111.     virtual TRegion     OnGetDropRegion();
  112.  
  113.     virtual bool         OnCanAcceptDrag(ItemReference item, const TDragSession& session);
  114.  
  115.     virtual void         OnDragReceive(const TDragSession& session);
  116.  
  117. //-----------------------------------
  118. //    TReanimator Support
  119. //
  120. public:
  121.     static     MReanimatable* Create(MReanimatable* parent);
  122.  
  123. //-----------------------------------
  124. //    Edit Commands API
  125. //
  126. public:    
  127.     typedef THandle SState;
  128.     
  129.             SState         GetState() const;
  130.             
  131.             void         SetState(const SState& state);
  132.  
  133. //-----------------------------------
  134. //    Internal API
  135. //
  136. protected:
  137.             void         DoChangeInfo();
  138.  
  139. //-----------------------------------
  140. //    Member Data
  141. //
  142. protected:
  143.     CResourceSubNode*    mWindows;
  144.     CResourceSubNode*    mViews;
  145.     CResourceSubNode*    mTextTraits;
  146.     CResourceSubNode*    mPens;
  147.  
  148.     TGWorld*            mDragImage;
  149. };
  150.  
  151.